<template>
  <div>
    <board-view/>
    <machine-view/>
    <packaging-view/>
  </div>
</template>

<script>
import boardView from './index'
import machineView from './machine'
import packagingView from './packaging'
import evBus from '@/utils/bus'
import {getNodes} from '@/services/monitoring'
import testTreeData from '@/layouts/tree.json'
import {mapState, mapMutations, mapGetters} from 'vuex'
export default {
  components:{
      boardView,
      machineView,
      packagingView
  },
  data(){
      return{
        testTreeData,
      }
  },
  computed:{
      ...mapState('account', ['treeNode']),
  },
  created(){
    this.getNodeFun()
  },
  mounted(){
      
      this.initView()
      this.receiveHandle()
  },
  methods:{
        ...mapMutations('account', ['setTreeNode']),
      initView(){
        // evBus.$on('initmsgView',(keys,ev)=>{
        //   console.log(keys)
        // })
        evBus.$emit('initmsgView',1111)
      },
      getNodeFun(){
    //    await getNodes().then(res=>{
    //      if(res.code === 0){
    //     } 
    //    })
    this.setTreeNode(this.testTreeData)
    evBus.$emit('initmsgView',1111,this.testTreeData)
    },
      receiveHandle(){
        evBus.$on('msgView',(keys,ev)=>{
          console.log(keys,ev)
        })
      }
  }
}
</script>

<style>

</style>